using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using ClassesBasicas;
using Negocio;
using Interfaces;
using System.Data.SqlClient;




namespace Apresentacao
{
    public partial class CadastrarFuncionario : Form
    {
        public Form1 frm = new Form1();
        Negocio.CadastroEmpregado cad = new CadastroEmpregado();
        public CadastrarFuncionario()
        {
            InitializeComponent();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void textBox4_TextChanged(object sender, EventArgs e)
        {

        }

        private void label5_Click(object sender, EventArgs e)
        {

        }

        private void btnAddDep(object sender, EventArgs e)
        {
            CadastrarDependentes dep = new CadastrarDependentes();
            //frm.dep = this;
            dep.ShowDialog();
        }

        private void btnCadFun(object sender, EventArgs e)
        {

            Empregado e1 = new Empregado();
            //
            e1.Endereco.Bairro = txtbairro.Text;
            e1.Endereco.Cep = int.Parse(txtcep.Text);
            e1.Endereco.Cidade = txtcidade.Text;
            e1.Endereco.Estado = txtestado.Text;
            e1.Endereco.Numero = int.Parse(txtn.Text);
            e1.Endereco.Pais = txtpais.Text;
            e1.Endereco.Rua = txtrua.Text;

            //e1.Endereco.Codigo = frm.cad.RecuperarEndereco();
            //e1.Matricula = Int32.Parse(txtmatricula.Text);
            e1.Nome = txtnome.Text;
            e1.Rg = Int32.Parse(txtrg.Text);
            e1.Salario = double.Parse(txtsalario.Text);
            e1.Sexo = txtsexo.Text;
            e1.Supervisor = new Empregado();
            e1.Supervisor.Nome = txtsupervisor.Text;
            e1.DataNascimento = DateTime.Parse(txtdata.Text);
            e1.Departamento.Codigo = (int)comboBox1.SelectedValue;
            
            frm.cad.Inserir(e1);
        
            MessageBox.Show("Cliente Cadastrado com Sucesso");

            button3.Enabled = true;
            
        }

        private void label9_Click(object sender, EventArgs e)
        {

        }

        private void textBox8_TextChanged(object sender, EventArgs e)
        {

        }

        private void label8_Click(object sender, EventArgs e)
        {

        }

        private void textBox7_TextChanged(object sender, EventArgs e)
        {

        }

        private void label7_Click(object sender, EventArgs e)
        {

        }

        private void textBox6_TextChanged(object sender, EventArgs e)
        {

        }

        private void label6_Click(object sender, EventArgs e)
        {

        }

        private void textBox5_TextChanged(object sender, EventArgs e)
        {

        }

        private void label4_Click(object sender, EventArgs e)
        {

        }

        private void textBox3_TextChanged(object sender, EventArgs e)
        {

        }

        private void label3_Click(object sender, EventArgs e)
        {

        }

        private void textBox2_TextChanged(object sender, EventArgs e)
        {
            
        }

        private void label2_Click(object sender, EventArgs e)
        {

        }

        private void textBox1_TextChanged(object sender, EventArgs e)
        {
            //txtmatricula.Enabled = false;
        }

        private void label1_Click(object sender, EventArgs e)
        {

        }

        private void label13_Click(object sender, EventArgs e)
        {

        }

        private void textBox10_TextChanged(object sender, EventArgs e)
        {

        }

        private void label22_Click(object sender, EventArgs e)
        {

        }

        private void CadastrarFuncionario_Load(object sender, EventArgs e)
        {
            // TODO: This line of code loads data into the 'empresaFlareDataSet6.Departamento' table. You can move, or remove it, as needed.
            this.departamentoTableAdapter1.Fill(this.empresaFlareDataSet6.Departamento);
            // TODO: This line of code loads data into the 'empresaFlareDataSet.Departamento' table. You can move, or remove it, as needed.
            //this.departamentoTableAdapter.Fill(this.empresaFlareDataSet.Departamento);

        }

        private void label21_Click(object sender, EventArgs e)
        {

        }

        private void txtpais_TextChanged(object sender, EventArgs e)
        {

        }

        private void txtestado_TextChanged(object sender, EventArgs e)
        {

        }

        private void txtcidade_TextChanged(object sender, EventArgs e)
        {

        }

        private void txtbairro_TextChanged(object sender, EventArgs e)
        {

        }

        private void txtcep_TextChanged(object sender, EventArgs e)
        {

        }

        private void label19_Click(object sender, EventArgs e)
        {

        }

        private void label18_Click(object sender, EventArgs e)
        {

        }

        private void label17_Click(object sender, EventArgs e)
        {

        }

        private void label16_Click(object sender, EventArgs e)
        {

        }

        private void label15_Click(object sender, EventArgs e)
        {

        }

        private void txtn_TextChanged(object sender, EventArgs e)
        {

        }

        private void label14_Click(object sender, EventArgs e)
        {

        }

        private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
        {

        }

        private void label12_Click(object sender, EventArgs e)
        {

        }

        private void label20_Click(object sender, EventArgs e)
        {

        }

        private void label11_Click(object sender, EventArgs e)
        {

        }

        private void label10_Click(object sender, EventArgs e)
        {

        }

        private void txtdata_TextChanged(object sender, EventArgs e)
        {

        }

        private void departamentoBindingSource_CurrentChanged(object sender, EventArgs e)
        {

        }

        private void groupBox2_Enter(object sender, EventArgs e)
        {

        }

        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {

        }
    }
}